/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       single_use_object.h

	$Header: /game/single_use_object.h $

	$NoKeywords: $

 ************************************************************************/
#ifndef SINGLE_USE_OBJECT_H_INCLUDED
#define SINGLE_USE_OBJECT_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "hero.h"
#include "stationary_adventure_object.h"

class t_basic_dialog;
class t_hero;

// ---------------------------------------------------------------
// objects which can only be visited by a hero once.
// ---------------------------------------------------------------
class t_single_use_object : public t_stationary_adventure_object
{
public:
	virtual void        activate_trigger( t_army* army, t_adv_map_point const& point, 
		                                  t_direction direction, t_adventure_frame* frame );
	virtual std::string get_balloon_help() const;
	int					get_single_use_id() const;
	virtual void		initialize( t_adventure_map& map );
	virtual void		place( t_adventure_map& map, t_adv_map_point const& point );
	virtual bool		read( std::streambuf&					 stream, 
							  t_qualified_adv_object_type const& type,
							  int								 version );
	virtual void		right_click( t_mouse_event const& event,
								     t_adventure_frame* adventure_frame );
	virtual bool        write( std::streambuf& stream ) const;	
protected:
	t_single_use_object( std::string const& model_name );

	virtual std::string add_icons( t_basic_dialog* dialog, std::string const& text, std::vector<t_hero*> const& heroes );
    virtual bool are_all_heroes_ineligible( t_army* army ) const;
	void				set_use_id( t_adventure_map& map );
	virtual void		visit( t_hero* hero ) = 0; 
	bool				visited() const;
private:
	int m_single_use_id;
};

inline t_single_use_object::t_single_use_object( std::string const& model_name )
                          : t_stationary_adventure_object( model_name )
{
	m_single_use_id = -1;
}

inline int t_single_use_object::get_single_use_id() const
{
	return m_single_use_id;
}

#endif // SINGLE_USE_OBJECT_H_INCLUDED
